
function initLayoutDocument() {
	cprint("init layout document");
	LayoutDocument._theLayoutDocument = new LayoutDocument();
}

function initControlPanel() {
	cprint("init control panel");
	ControlPanel._theControlPanel = new ControlPanel();
}

function initCanvas() {
	cprint("init canvas");
	Canvas._theCanvas = new Canvas();
}

function positionGUIElements() {
	$("#control_panel_container").dialog({
		position: [0, 0],
		width: 375,
		height: window.innerHeight * .98,
		maxHeight: window.innerHeight
	});
	$("#control_panel_container").css("left", "0px");
	
	
	$("#canvas_container").dialog({
		position: [$("#control_panel_container").parent(".ui-dialog").width(), 0],
		height: window.innerHeight * .98,
		width: (window.innerWidth - $("#control_panel_container").parent(".ui-dialog").width()) * .98,
		maxHeight: window.innerHeight
	});
	
	
	// This fixes a background image conflict between the jquery-ui dialog and the canvas container
	$("#canvas_container").css("background", "#c0c0c0 url('img/transparent.png')");
	$("#canvas_container").css("left", $("#control_panel_container").width() + "px");
}

function escapeHtml(str) {
	return str.split("<").join("&lt;").split(">").join("&gt;");
}
